<template>
  <nf-button
    v-bind="buttonMeta"
    :componentKind="componentKind"
    :moduleId="moduleId"
    :dataId="selection.dataId"
    :dataIds="selection.dataIds"
  >
  </nf-button>
</template>

<script lang="ts">
  import { defineComponent, reactive, defineAsyncComponent } from 'vue'
  import _buttonMeta from '../../button/button.json'
  // import myForm from './form.vue'
  // import list from '../listPage.vue'
 
  export default defineComponent({
    name: 'nf-ui-elp-comp-button',
    components: {
    },
    props: {
      moduleId: Number,
      selection: Object,
      active: Object
    },
    setup(props, context) {

      console.log('操作按钮的属性', props)
      const buttonMeta = reactive(_buttonMeta)

      buttonMeta.events = {
        deleteClick: (id, meta) => {
          // console.log('按了删除按钮：', id, meta)
          return true
        }
      }

      // 弹窗打开的组件的字典
      const componentKind = {
        form: defineAsyncComponent(() => import('./form.vue')),
        list: defineAsyncComponent(() => import('./pager.vue'))
      }

      return {
        buttonMeta,
        componentKind
      }
    }
  })
</script>